package com.itheima.mapper;

import com.itheima.pojo.OrderSetting;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.time.LocalDate;
import java.util.List;
import java.util.Map;

@Mapper
public interface OrderSettingDao {


    @Update("update t_ordersetting set number = #{number} where orderDate = #{orderDate}")
    void editMNumberByDate(Map<String, Object> map);



    List<OrderSetting> getOrderSettingByMonth(String month);

    @Insert("insert  into t_ordersetting(orderDate,number,reservations) values(#{orderDate},#{number},#{reservations})")
    void add(OrderSetting orderSetting);


    @Select("select * from t_ordersetting where orderDate = #{date}")
    OrderSetting findOrderDate(LocalDate date);


    @Select("select orderDate,number,reservations from t_ordersetting where orderDate = #{s}")
    OrderSetting findByOrderDate(String s);

    @Update("update t_ordersetting set reservations = #{reservations} where orderDate=#{orderDate}")
    void editReservations(OrderSetting orderSetting);
}
